<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8" />
    <script type="text/javascript">
        function allowDrop(event) {
            alert("245");
            event.preventDefault();
        }

        function drag(event) {
            // alert("678");
            event.dataTransfer.setData("Text", event.target.id);
        }

        function drop(event) {
            alert("24524");
            event.preventDefault();
            var data = event.dataTransfer.getData("Text");
            event.target.appendChild(document.getElementById(data));
        }
    </script>
</head>

<body>
    <div id="div" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
    <br />
    <p>asflkjaskdljf</p>
    <img id="img" src="../resource/abc.png" draggable="true" ondragstart="drag(event)" width="300" height="80" />

</body>

</html>